// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package kind

// TicketSeatStrategy
// 钓位策略.
type TicketSeatStrategy int

const (
	TicketSeatStrategyFirstArrived TicketSeatStrategy = 1
	TicketSeatStrategyUserChoose   TicketSeatStrategy = 2
	TicketSeatStrategyDrawLot      TicketSeatStrategy = 3
)

var (
	ticketSeatStrategyTexts = map[TicketSeatStrategy]string{
		TicketSeatStrategyFirstArrived: "先到先得",
		TicketSeatStrategyUserChoose:   "自选",
		TicketSeatStrategyDrawLot:      "抽签",
	}
	ticketSeatStrategyFlags = map[TicketSeatStrategy]string{
		TicketSeatStrategyFirstArrived: "arrived",
		TicketSeatStrategyUserChoose:   "choose",
		TicketSeatStrategyDrawLot:      "draw",
	}
)

func TicketSeatStrategyDict() []map[string]any {
	var res = make([]map[string]any, 0)
	for _, v := range []TicketSeatStrategy{
		TicketSeatStrategyFirstArrived,
		TicketSeatStrategyUserChoose,
		TicketSeatStrategyDrawLot,
	} {
		res = append(res, map[string]any{
			"Key":   v,
			"Value": v.Text(),
		})
	}
	return res
}

func (o TicketSeatStrategy) Flag() string {
	if str, ok := ticketSeatStrategyFlags[o]; ok {
		return str
	}
	return ""
}

func (o TicketSeatStrategy) IsFirstArrived() bool { return o == TicketSeatStrategyFirstArrived }
func (o TicketSeatStrategy) IsUserChoose() bool   { return o == TicketSeatStrategyUserChoose }
func (o TicketSeatStrategy) IsDrawLot() bool      { return o == TicketSeatStrategyDrawLot }

func (o TicketSeatStrategy) Text() string {
	if str, ok := ticketSeatStrategyTexts[o]; ok {
		return str
	}
	return ""
}
